package srv

import (
	"venus/servers/game/handlers"
	"venus/service/sv_tcp"
	"venus/service/sv_tcp/znet/zpb"
	"venus/service/sv_tcp/znet/ztcp"
	"venus/util/zlog"
)

// TcpConnStart 连接新建
func TcpConnStart(conn *ztcp.TcpConnection) {
	zlog.Debug("TcpConnStart")
}

// TcpConnStop 连接断开
func TcpConnStop(conn *ztcp.TcpConnection) {
	zlog.Debug("TcpConnStop")
	// todo 断线处理 玩家解除绑定
	//player := logic.ConnGetPlayer(conn)
	//if player != nil {
	//	logic.PlayerDisconnection(player)
	//}
}

// TcpRegister 消息注册
func TcpRegister() {

	zlog.Debug("TcpRegister")

	//worker.TcpWorkerBind(zpb.EPid_CGGmAction, handler.CGGmAction)

	sv_tcp.BindSpeedy((*zpb.C2LUserLogin)(nil), handlers.CLUserLogin) // 用户登入

	sv_tcp.Bind((*zpb.C2GPlayerLogin)(nil), handlers.C2GPlayerLogin)   // 玩家登入
	sv_tcp.Bind((*zpb.C2GPlayerCreate)(nil), handlers.C2GPlayerCreate) // 玩家创建
	sv_tcp.Bind((*zpb.C2GEnterGame)(nil), handlers.C2GEnterGame)       // 玩家进入游戏
	//
	//worker.TcpWorkerBind(zpb.EPid_CGPlayerChangeName, handler.CGPlayerChangeName)
	//worker.TcpWorkerBind(zpb.EPid_CGPlayerChangeHead, handler.CGPlayerChangeHead)
	//worker.TcpWorkerBind(zpb.EPid_CGPlayerChangeFlagInt, handler.CGPlayerChangeFlagInt)
	//worker.TcpWorkerBind(zpb.EPid_CGPlayerChangeFlagIntDaily, handler.CGPlayerChangeFlagIntDaily)
	//
	//sv_tcp.Bind(zpb.EPid_CGPlayerInit, handlers.CGPlayerInit)
	//
	//sv_tcp.Bind(zpb.EPid_CGMailListGet, handler.CGMailListGet)
	//worker.TcpWorkerBind(zpb.EPid_CGMailRead, handler.CGMailRead)
	//worker.TcpWorkerBind(zpb.EPid_CGMailGet, handler.CGMailGet)
	//worker.TcpWorkerBind(zpb.EPid_CGMailDelete, handler.CGMailDelete)
	//worker.TcpWorkerBind(zpb.EPid_CGMailGetAll, handler.CGMailGetAll)
	//worker.TcpWorkerBind(zpb.EPid_CGMailDeleteAll, handler.CGMailDeleteAll)
	//
	//worker.TcpWorkerBind(zpb.EPid_CGItemInfoGet, handler.CGItemInfoGet)
	//
	//worker.TcpWorkerBind(zpb.EPid_CGEquipInfoGet, handler.CGEquipInfoGet)

}
